package zjc.随机数;

import java.util.Random;
import java.util.Scanner;

public class random {
    public static void main(String[] args) {
        Random c = new Random();
        Scanner sr = new Scanner(System.in);
        int n = c.nextInt(10);
        System.out.println("0~9随机数："+n);
        System.out.println("1-10随机数："+(n+1));
        System.out.println("5-10随机数："+(c.nextInt(6)+5));
        System.out.println("------------");
        //案例：数字炸弹1~100随机数猜中中奖
        int m=c.nextInt(100)+1;
        int s;
        int count=0;
        while(true){
            System.out.println("0-100随机数请输入你猜测的数字：");
            s=sr.nextInt();
            count++;
            if(s==m){
                System.out.println("操居然被你猜到了");
                System.out.println("你用了"+count+"次猜到了");
                break;
            }else if(s>m){
                System.out.println("猜大了吃屎去吧你");
            }else{
                System.out.println("猜小了吃屎去吧你");
            }
        }
    }


}
